<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<div id="app">
    <p>{{msg}}</p>
</div>
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
<script>
   var lastName = 'san'
    //创建Vue的实例
   var vm = new Vue({
    el:'#app',
    data:{
        msg:'hello',
        age:18
    }
   });
  //如果你使用了$nextTick,视图不会立刻更新，而是等待js事件循环的下一个tick时会更新DOM
  //
  var app = document.getElementById('app');
  vm.msg = 'world1';
  vm.msg = 'world2';
  console.log('1',app.innerText);
  setTimeout(()=>{
    console.log('setTimeout',app.innerText);
  });
  vm.$nextTick(()=>{
    console.log('nextTick',app.innerText);
  });
   

</script>
</body>
</html>